<?
$sub_menu = "230460";
include_once("./_common.php");

auth_check($auth[$sub_menu], "w");

$qstr .= "&fr_date=$fr_date&to_date=$to_date&date=$date&mi_day=$mi_day&acc=$acc";

$log = array();

if ($w == "u")
{
    $sql = "select * from $mw_cash[membership_log_table] where ml_id = '$ml_id'";
    $log = sql_fetch($sql);
}
else if ($w == "") {
    if ($_GET[mb_id])
        $log[mb_id] = $mb_id;
}

$g4['title'] = "멤버쉽 내역";
include_once ("$g4[admin_path]/admin.head.php");
?>

<style>
table.tconfig tbody td:first-child { width:30%; color:#616161; padding:5px 0px 5px 10px; font-weight:bold; text-align: right; }
table.tconfig tbody td:nth-child(2) { width:70%; color:#868686; padding:5px 10px 5px 10px; }
</style>

<table width=100% cellpadding=0 cellspacing=0 border=0>
<colgroup width=30% class='col1 pad1 bold right'>
<colgroup width=70% class='col2 pad2'>
<tr class='ht'>
    <td colspan=4 align=left><?=subtitle($g4[title])?></td>
</tr>
<tr><td colspan=4 class=line1></td></tr>
</table>

<form name="fconfig" method="post" action="mw.membership.log.update.php">
<input type=hidden name=w     value='<?=$w?>'>
<input type=hidden name=ml_id     value='<?=$ml_id?>'>
<input type=hidden name=sfl   value='<?=$sfl?>'>
<input type=hidden name=stx   value='<?=$stx?>'>
<input type=hidden name=sst   value='<?=$sst?>'>
<input type=hidden name=sod   value='<?=$sod?>'>
<input type=hidden name=page  value='<?=$page?>'>
<input type=hidden name=token value='<?=$token?>'>
<input type=hidden name=fr_date value="<?=$fr_date?>">
<input type=hidden name=to_date value="<?=$to_date?>">
<input type=hidden name=date value="<?=$date?>">
<input type=hidden name=mi_day value="<?=$mi_day?>">
<input type=hidden name=acc value="<?=$acc?>">

<table width=100% cellpadding=0 cellspacing=0 border=0 class="tconfig">
<colgroup width=30% class='col1 pad1 bold right'>
<colgroup width=70% class='col2 pad2'>
<tr class='ht'>
    <td> 회원ID </td>
    <td> 
        <? if ($w == "") { ?>
        <input type="text" name="mb_id" class="ed" size="20" required itemname="회원ID" value="<?=$log[mb_id]?>">
        <?=help("여러명 입력할 경우 ,컴마로 구분해주세요. 예) test1, test2, test3")?>
        <? } else { ?>
        <a href="mw.membership.log.php?sfl=mb_id&stx=<?=$log[mb_id]?>"><?=$log[mb_id]?></a>
        <? } ?>
    </td>
</tr>
<tr class='ht'>
    <td>멤버쉽</td>
    <td>
        <select name="ms_id" required itemname="멤버쉽">
        <option value=""> </option>
        <?
        $sql = "select * from $mw_cash[membership_table] order by ms_id";
        $qry = sql_query($sql);
        while ($row = sql_fetch_array($qry)) {
        ?>
        <option value="<?=$row[ms_id]?>"><?=$row[ms_name]?></option>
        <? } ?>
        </select>

        <script type="text/javascript">
        document.fconfig.ms_id.value = "<?=$log[ms_id]?>";
        </script>
    </td>
</tr>
<tr class='ht'>
    <td><?=$mw_cash[cf_cash_name]?></td>
    <td>
        <? if ($w == "") { ?>
        <input type="text" name="ml_cash" class="ed" size="20" numeric required itemname="<?=$mw_cash[cf_cash_name]?>" value="<?=$log[ml_cash]?>">
        <?=$mw_cash[cf_cash_unit]?>
        <? } else { ?>
        <?=$log[ml_cash]?> <?=$mw_cash[cf_cash_unit]?>
        <? } ?>

        <? if ($log[ml_direct]) echo "(바로결제)"; ?>
    </td>
</tr>
<tr class='ht'>
    <td> 기간 </td>
    <td> 
        <input type="text" name="ml_day" class="ed" size="20" required numeric itemname="기간" value="<?=$log[ml_day]?>"> 일
    </td>
</tr>
<tr class='ht'>
    <td> 시작일 </td>
    <td> 
        <input type="text" name="ml_sdate" size="20" class="ed" itemname="시작일" value="<?=$log[ml_sdate]?>">
        <? if ($w == "") echo "(기간만 입력하고 시작일을 비워두면 자동으로 입력됩니다.)" ?>
    </td>
</tr>
<tr class='ht'>
    <td> 종료일 </td>
    <td> 
        <input type="text" name="ml_edate" size="20" class="ed" itemname="종료일" value="<?=$log[ml_edate]?>">
        <? if ($w == "") echo "(기간만 입력하고 종료일을 비워두면 자동으로 입력됩니다.)" ?>
    </td>
</tr>
<? if ($w == "u") { ?>
<tr class='ht'>
    <td> 결제일시 </td>
    <td> 
        <?=$log[ml_datetime]?>
    </td>
</tr>
<? if (trim($log[ml_log])) {?>
<tr class='ht'>
    <td> 변경로그 </td>
    <td> 
        <?=nl2br($log[ml_log])?>
    </td>
</tr>
<? }} ?>
</table>

<br/>
<br/>
<p align=center>
    <input type=submit class=btn1 accesskey='s' value='  확  인  '>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <input type=button class=btn1 value='  목  록  ' onclick="document.location.href='mw.membership.log.php?<?=$qstr?>';">
</p>

</form>



<?
include_once ("$g4[admin_path]/admin.tail.php");
?>

